L('/CreateThread', ':[Function]')(function() {return [
	'do',
	function(){
		//_('~Status')(':set','Edit')
	},
	'Edit-Tabs',
	function(_){
		var tp=_;
		_.Tab=function(dom,show_dom){
			this.tab=dom;
			this.eidt=show_dom;
			var ths=this
			dom.click(function(){
				ths.select();
				/*
			tp.pick.css
			
			tp.pick=dom;
			fun();
			//tp.pick=);
				*/
			});
			//dom.onClick(function(){});
			//this.id=id;
		};
		_.Tab.prototype.select=function(){
			this.pick.val.tab.css({'background-color':'#5F9EA0'});
			this.pick.val.edit.css({display:'none'});
			this.tab.css({'background-color':'#A52A2A'});
			this.eidt.css({display:'block'});
			this.pick.val=this;
		};
		_.Tab.prototype.remove = function(first_argument) {
			this.dom.remove();
		};
		_.Tab.prototype.pick={val:null};
		$(document).ready(function() {
			_.Tabs=$('#Premond-make-master-editTabs');
			_.Tab.prototype.pick.val={tab:$('#Premond-make-master-editTabs-none'),edit:$('#Premond-make-master-editTabs-none')};
		});
		_('~Thread')()('!~...=')('Edit-Tabs',function(_,dom,id_name,name){
			switch(this.keys[1]){
				case 'new':
				tp.Tabs.append('<div id=\'Premond-make-master-editTabs-'+
						id_name+'\'>'+name+'</div>');
					return new tp['Tab']($('#Premond-make-master-editTabs-'+id_name),dom);
			};
		});
	},
	'Edit',
	function(_){
		var tp=_;
		_.th=function(_,val){
			switch(this.keys[0]){
				case 'start':
				/*
					if(this.ext.val.location.length===1){
						_('!x_x')();

						return 0;
					}else if((_.dom=$('#Premond-make-master-editBoxs-'+this.ext.val.location.join('-'))).length!==0){
						_.dom
				*/
					_('~api:tree')(':exist',this.ext.val.location,'#find_res');
				break;
				case 'find_res':
				if(val.res){
					_('~api:tree')(':enum-val',this.ext.val.location,'#continue');
				}else{
					_('#continue')({found:false});

					/*
					_.id_allocated++;
					$('#Premond-make-master-editBoxs').append('<div id=\'Premond-make-master-editBoxs-'+
						_.id_allocated+'\'></div>');
					var dom=$('#Premond-make-master-editBoxs-'+_.id_allocated);
					console.log('not found');
									case '#get_res':
					val;
				break;
					*/
				};
				break;
				case 'continue':
					var location=this.ext.val.location;
					var str=location.join('-');
					var pdom=$('#Premond-make-master-editBoxs').append('<div id=\'Premond-make-master-editBoxs-'+
						str+'\'></div>');
					var dom=$('#Premond-make-master-editBoxs-'+str);
					_('~Edit-Tabs:new')(dom,str,location[location.length-1]);
					//var dom2=$('#Premond-make-master-editBoxs-'+_.id_allocated);
					break;

			};
		};
		_('~Thread')()('!~...=')('Edit',function(_,val){
			switch(this.keys[1]){
				case 'on':
					if(val.location.length===1) return 0;
					val.location[0]='root';
					var th=_(val.location.join('-'),'!_')();
					if(th.exist===true){
						th('#reon')();
					}else{
					var thread_msgr=_('/Tool/rebind')(tp.th,'ext',{val:val});
						th('!#=')(thread_msgr);
						th('#start')();
					}
					//_('../api',':tree')(':find',val.location,'#find');
			};
		});
	},
	'tree-init',
	function(_) {
		/*
		function searchNode(e) {
			var zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
			if (!$("#getNodesByFilter").attr("checked")) {
				var value = $.trim(key.get(0).value);
				var keyType = "";
				if ($("#name").attr("checked")) {
					keyType = "name";
				} else if ($("#level").attr("checked")) {
					keyType = "level";
					value = parseInt(value);
				} else if ($("#id").attr("checked")) {
					keyType = "id";
					value = parseInt(value);
				}
				if (key.hasClass("empty")) {
					value = "";
				}
				if (lastValue === value) return;
				lastValue = value;
				if (value === "") return;
				updateNodes(false);

				if ($("#getNodeByParam").attr("checked")) {
					var node = zTree.getNodeByParam(keyType, value);
					if (node === null) {
						nodeList = [];
					} else {
						nodeList = [node];
					}
				} else if ($("#getNodesByParam").attr("checked")) {
					nodeList = zTree.getNodesByParam(keyType, value);
				} else if ($("#getNodesByParamFuzzy").attr("checked")) {
					nodeList = zTree.getNodesByParamFuzzy(keyType, value);
				}
			} else {
				updateNodes(false);
				nodeList = zTree.getNodesByFilter(filter);
			}
			updateNodes(true);
							zTree.addNodes(root, {
					id: (100 + newCount),
					pId: root.id,
					isParent: true,
					name: "请重命名" + (newCount++)
				});

		}
		*/
		var zTree;
		function search_zt_node_root(){
			var zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
			var keyType='name';value='网站根目录';
			var res=zTree.getNodeByParam(keyType, value);
			return res;
		};
		function search_zt_node(val){
			var zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
			var keyType='name';var parent_name=$('#'+val+'_a')[0].title;
			var res=zTree.getNodeByParam(keyType, parent_name);
			return {name:parent_name,parent:res};
		};
		function addHoverDom(treeId, treeNode) {
			var sObj = $("#" + treeNode.tId + "_span");
			if (treeNode.editNameFlag || $("#addBtn_"+treeNode.tId).length>0) return;
			var addStr = "<span class='button add' id='addBtn_" + treeNode.tId
				+ "' title='add node' onfocus='this.blur();'></span>";
			sObj.after(addStr);
			var btn = $("#addBtn_"+treeNode.tId);
			if (btn) btn.bind("click", function(){
				var zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
				zTree.addNodes(treeNode, {id:(100 + newCount), pId:treeNode.id, name:"请重命名" + (newCount++)});
				return false;
			});
		};
		function removeHoverDom(treeId, treeNode) {
			$("#addBtn_"+treeNode.tId).unbind().remove();
		};
		function showRemoveBtn(treeId, treeNode) {
			if(treeNode.level===0)
				return false;
			return true;
		}
		function showRenameBtn(treeId, treeNode) {
			if(treeNode.level===0)
				return false;

			return true
		}
		var setting = {
			view: {
				addHoverDom: addHoverDom,
				removeHoverDom: removeHoverDom,
				selectedMulti: false
			},
			edit: {
				enable: true,
				editNameSelectAll: true,
				showRemoveBtn: showRemoveBtn,
				showRenameBtn: showRenameBtn
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			/*
			callback: {
				beforeDrag: beforeDrag,
				beforeEditName: beforeEditName,
				beforeRemove: beforeRemove,
				beforeRename: beforeRename,
				onRemove: onRemove,
				onRename: onRename
			}
			*/	
			callback: {
				beforeDrag: function() {
					return false
				},
				beforeEditName:function(){},
				beforeRemove: function() {},
				beforeRename: function() {},
				onRename: function(){},
				onRemove: function() {},
				beforeClick: function(treeId, treeNode, clickFlag) {
					
				},
				onClick: function(event, treeId, treeNode, clickFlag) {
					
					var now=treeNode;
					var location=[];
					location.unshift(treeNode.name);
					for(;1;){
						if(!now.parentTId){
							break;
						}else{
							var res=search_zt_node(now.parentTId);
							location.unshift(res.name);
							now=res.parent;
						};
					};
					_('~Edit:on')({location:location,now:treeNode});
				},
			}
		};
		var newCount = 1;
		function add(isParent) {
			var zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
			//isParent = e.data.isParent,
			nodes = zTree.getSelectedNodes();
			treeNode = nodes[0];
			if (treeNode) {
				treeNode = zTree.addNodes(treeNode, {
					id: (100 + newCount),
					pId: treeNode.id,
					isParent: isParent,
					name: "new node" + (newCount++)
				});
			} else {
				treeNode = zTree.addNodes(null, {
					id: (100 + newCount),
					pId: 0,
					isParent: isParent,
					name: "new node" + (newCount++)
				});
			}
			if (treeNode) {
				zTree.editName(treeNode[0]);
			} else {
				alert("叶子节点被锁定，无法增加子节点");
			}
		};
		$(document).ready(function() {
			_('#dom_ready')();
		});

		_('!#=')(function(_,val) {
			switch(this.keys[0]){
				case 'dom_ready':
				$.fn.zTree.init($("#Premond-make-master-Tree"),setting,[{name: "网站根目录", children: []}]);
				zTree = $.fn.zTree.getZTreeObj("Premond-make-master-Tree");
				_('~api:tree')(':enum-val',[],'#root');
				break;
				case 'root':
				val=val['enum'];
				var root=search_zt_node_root();
				for(var i=0,len=val.length;i<len;i++){
					zTree.addNodes(root, {
					id: (100 + newCount),
					pId: root.id,
					isParent: true,
					name: val[i],
					});
				};
				break;
				
			};
		});
	},
	'api',
	function(_){
		_.JSON5=_('/Tool/JSON5')();
		_.state_Change_tree=function() {
				if (this.xmlhttp.readyState == 4) {
					if (this.xmlhttp.status == 200) {
						console.log(this.xmlhttp.responseText);
						this.senter(this.way)(_.JSON5.parse(this.xmlhttp.responseText));
					} else {
						alert("Problem retrieving XML data");
					}
				}
		}

		_.req_tree=function(method,addr,senter,way){
			var req_head={get:'tree',method:method,location:addr};
			var str_req_head=_.JSON5.stringify(req_head);
			var xmlhttp;
			if (window.XMLHttpRequest) { // code for all new browsers
				xmlhttp = new XMLHttpRequest();
			} else if (window.ActiveXObject) { // code for IE5 and IE6
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			if (xmlhttp != null) {
				xmlhttp.onreadystatechange = _.state_Change_tree.bind({xmlhttp:xmlhttp,senter:senter,way:way});
				xmlhttp.open("POST","../api", true);
				//xmlhttp.setRequestHeader('api',);","application/x-www-form-urlencoded"
				xmlhttp.setRequestHeader("Content-Type",'text/plain');
				xmlhttp.send(str_req_head);
			} else {
				alert("Your browser does not support XMLHTTP.");
			}

		};
		var tp=_;
		_('~Thread')()('!~...=')('api',function(_,method,addr,way){
			//console.log(this.keys);
			switch(this.keys[1]){
				case 'tree':
				tp.req_tree(method,addr,this.senter,way);
				break;
			}
		});
	},
]})